-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
project completed #2
base: master
Are you sure you want to change the base?
Conversation
return x ** 2 | ||
elif f[0] == "cube": | ||
# print("return : ", f[1]**3 ) | ||
return x ** 3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job overall, but I think you can remove the commented print code when submitting
if randomfunction in ["x","y"]: | ||
list.append(randomfunction) | ||
return list | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the two if statements from the bottom, I think you can make it as elif
statement. That would make the code to jump right to the return if the randomfunction
was 'avg' or 'prod'. (Just minor details)
Also, I think list
is a reserved keyword for python language, so I would recommend not to use list as variable names. Sometimes you might see unexpected behaviors
>>> evaluate_random_function(["sin_pi", ["avg", ["prod", ["avg", ["x"],["y"]], ["x"]], ["prod", ["x"], ["y"]]]], 0, 0) | ||
0.0 | ||
>>> evaluate_random_function(['sin_pi', ['cos_pi', ['cos_pi', ['x']]]], -1, -1) | ||
0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like how you added more unit tests! Great!
Thanks for the feedback Tony!
For the future I will keep these critiques in mind when coding!
…On Wed, Oct 11, 2017 at 4:12 AM, Young Seok Tony Kim < ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In recursive_art.py
<#2 (comment)>
:
> @@ -42,9 +63,48 @@ def evaluate_random_function(f, x, y):
-0.5
>>> evaluate_random_function(["y"],0.1,0.02)
0.02
+ >>> evaluate_random_function(["prod"],4,2)
+ 8
+ >>> evaluate_random_function(["prod", ["x"], ["y"]], 0, 0)
+ 0
+ >>> evaluate_random_function(["prod", ["avg", ["x"],["y"]], ["x"]], 2, 2)
+ 4
+ >>> evaluate_random_function(["avg", ["prod", ["avg", ["x"],["y"]], ["x"]], ["prod", ["x"], ["y"]]], 0, 0)
+ 0.0
+ >>> evaluate_random_function(["sin_pi", ["avg", ["prod", ["avg", ["x"],["y"]], ["x"]], ["prod", ["x"], ["y"]]]], 0, 0)
+ 0.0
+ >>> evaluate_random_function(['sin_pi', ['cos_pi', ['cos_pi', ['x']]]], -1, -1)
+ 0.0
I like how you added more unit tests! Great!
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#2 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AeO8pmuv-z8oTAdEHWSTy6nNkG5Lf2E_ks5srHiLgaJpZM4PpuzH>
.
|
No description provided.